package edu.sctu.practice.class02.yangyuran.test02;

import java.util.Scanner;

/**
 * Created by Administrator on 2015/10/9.
 */
public class Vehicle {

    public float speed;
    public float size;

    public void move() {
        System.out.println("交通工具可以移动。");
    }

    public void setSpeed(int speed) {
        System.out.println("初始速度为:" + speed + "km/h");
        this.speed = speed;
    }

    public void setSpeedUp() {

        System.out.println("请设置要增加的速度：");
        Scanner num = new Scanner(System.in);
        int setspeed = num.nextInt();
        this.speed = setspeed + this.speed;
        System.out.println("加速后的速度为：" + this.speed);
    }


    public void speedDown() {

        System.out.println("请设置要减少的速度：");
        Scanner num = new Scanner(System.in);
        int speeddown = num.nextInt();
        this.speed = this.speed - speeddown;
        System.out.println("减速后的速度为：" + this.speed);
    }
}
